<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
  * {
    margin: 0;
    padding: 0;
  }
  .container {
    width: 1200px;
    margin: 0 auto;
  .box {
    box-sizing: border-box;/*盒模型设置为怪异(IE)盒模型，*/
    margin: 0 10px;
    border: 1px solid #000;
    padding: 5px;
    display:inline-block; /*天坑 有间隙*/
    width: 580px;
    height: 100px;
    background-color: green;
  }
  .box:nth-child(2) {
    background: yellow;
  }

  </style>
</head>
<body>
  <div class="container">
    <div class="box">1</div><div class="box">2</div>
  </div>
</body>
</html>